package com.imooc.controller;

import com.imooc.common.result.ResponseData;
import com.imooc.common.result.ResponseUtils;
import com.imooc.pojo.Items;
import com.imooc.service.IItemService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName: ItemsController
 * @Description: 商品接口Controller
 * @author: limingxing
 * @Date: 2019-12-27 14:51
 */
@RestController
@RequestMapping("items")
@Api(value = "商品接口", tags = {"商品信息展示的相关接口"})
public class ItemsController {

    @Autowired
    private IItemService itemService;

    @GetMapping("/info/{itemId}")
    @ApiOperation(value = "查询商品详情", notes = "查询商品详情", httpMethod = "GET")
    public ResponseData info(
            @ApiParam(name = "itemId", value = "商品id", required = true)
            @PathVariable String itemId) {
        Items items = itemService.queryItemById(itemId);
        return ResponseUtils.success(items);
    }
}
